<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>

</body>

</html>

<script>
    function f() {
        console.log(this.x)
    }
    var obj = {
        x: 1
    }
    f.call(obj)
    var obj = {
        x: 3,
        doit: function () {
            console.log("method os called." + this.x)
        }
    }
    var obj2 = {
        x: 4
    }
    obj.doit.call(obj2)

    function f2(a, b, c) {
        console.log("this.x = " + this.x + ",a = " + a + ",b=" + b + ',c=' + c)
    }
    f2.apply({
        x: 4
    }, [1, 2])
    f2.call({
        x: 5
    }, 2, 3, 4)
</script>